package com.gsi.multichannel.sf.pipelet;

import com.intershop.beehive.core.capi.naming.NamingMgr;
import com.intershop.beehive.core.capi.pipeline.Pipelet;
import com.intershop.beehive.core.capi.pipeline.PipelineDictionary;
import com.intershop.beehive.xcs.capi.product.Product;
import com.intershop.beehive.xcs.capi.product.ProductMgr;

/**
 * 
 */
public class CheckAttribute extends Pipelet
{
    public static final String DN_UUID = "uuid";
    public static final String DN_YEAH = "ans";
    private ProductMgr manager;
    public int execute(PipelineDictionary dict)
    {
        String uuid = dict.getOptional(DN_UUID);
        manager = (ProductMgr)NamingMgr.getInstance().lookupManager(ProductMgr.REGISTRY_NAME);
        Product pr = manager.getProductByUUID(uuid);
        String answer = (String)pr.getAttribute("MyAttribute");
        dict.put(DN_YEAH, answer);
        return PIPELET_NEXT;
    }
}